'use strict';
import * as d3 from "d3";
import GDPpaint from "./GDP.js";
import csvGDP from "./assets/GDP.csv";
import Budgetpaint from "./Budget.js";
import csvBudget from "./assets/Budget.csv";
import Paypaint from "./Pay.js";
import csvPay from "./assets/Pay.csv";
import _sunburst from "./sunburst.js"
import json from "./tianjin.geoJson";
import tianjin_map from "./tianjin_map.js";

var Status = 0;//0代表天津，1-16代表各区

d3.json(json).then(
    (data, error) => {
        if (error) {
            console.log(error);
        } else {
            // console.log(data);
            tianjin_map(d3, data);
        }
    }
)
d3.csv(csvGDP).then((dataGDP, error) => {
  if (error) {
    console.log(error);
  } else {
    GDPpaint(dataGDP,Status);
  };
});

d3.csv(csvPay).then((dataPay, error) => {
  if (error) {
    console.log(error);
  } else {
    Paypaint(dataPay,Status);
  };
});

d3.csv(csvBudget).then((dataBudget, error) => {
  if (error) {
    console.log(error);
  } else {
    Budgetpaint(dataBudget,Status);
  };
});

// 获取 SVG 元素
const svgElement = _sunburst(d3);
// 获取包含 SVG 的容器元素
const container = document.getElementById("divSun");
// 将 SVG 元素添加到容器
container.appendChild(svgElement);


